Database reference guide

HOME

Distance Calculations

If the system has been configured with X and Y co-ordinates together with a Plot Key field, it is possible to perform intrinsic distance calculations, using the DISTANCE() function in the form:

DISTANCE(<column>,<value>)

Both the column and the value are of the same format as the Plot Key.

For example, where the geographic key is UK postcodes, and you want to find the number of addresses within one mile of a certain postcode, you could write:

SELECT Count(*)

From Customers

Where DISTANCE(Postcode, “BS2 9AG”) <

1609;

Note: The units of distance are defined by the value in the X and Y co-ordinate fields.

These kinds of intrinsic functions can only be used with the specified field types and cannot be stacked, i.e. you cannot write STRIP(UCASE(<column name>)). However, this kind of functionality and more can be achieved using Expressions.

  Online & Instructor-Led Courses | Training Videos | Webinar Recordings
© Alterian. All Rights Reserved. | Privacy Policy | Legal Notice